From Self-Interpreters to Normalization by Evaluation
نویسنده
چکیده
We characterize normalization by evaluation as the composition of a self-interpreter with a self-reducer using a special representation scheme, in the sense of Mogensen (1992). We do so by deriving in a systematic way an untyped normalization by evaluation algorithm from a standard interpreter for the λ-calculus. The derived algorithm is not novel and indeed other published algorithms may be obtained in the same manner through appropriate adaptations to the representation scheme. 1. Self-interpreters and self-reducers What is a self-interpreter? For the untyped λ-calculus, Mogensen (1992) offers the following definition, given an injective mapping x y (the representation scheme) that yields representations of arbitrary terms: E xMy β M. That is, a self-interpreter is a term E of the λ-calculus such that when applied to the representation xMy of any term M, the result is a convertible term (modulo renaming). The x y mapping cannot of course be defined within the λ-calculus itself, but we posit its existence as a primitive operation of the calculus. The representation of a term is a piece of data, something that can be manipulated, transformed and inspected within the calculus itself. It is natural to represent data as terms in normal form, so that datamay be regarded as constant with regard to term reduction. Consider the following grammar for terms and normal terms: Var Q x, y, z Term Q t F x | λx.t | t t Term TermNF Q tn F ta | λx.tn Term TermA Q ta F x | ta tn The representation scheme can be typed as x y : Term Ñ TermNF. All manner of representation schema are possible, but Mogensen commits to a particularly simple representation scheme, one that enables him to implement a trivially simple selfinterpreter that not only yields convertible terms from their representations, but in fact whose weak head normal form when applied to a normal term M is identical to M, up to renaming of variables. Let us call this particular self-interpreter Eα. We have that Eα xMy ÝÑwhnf M. Mogensen goes on to define a self-reducer as a transformation on representations: R xMy β xNFMy, whereNFM stands for the normal formofM, if one exists. Equippedwith such a contraption, we can define a special kind of self-interpreter with the additional property that all representations 1This is an analogue of the quote special form of Scheme. 35 36 MATHIEU BOESPFLUG of terms evaluate to normal forms. For all M, ENF xMŷEαpR xMyq ÝÑwhnf NFM. After a small detour towards concrete implementations of the above, we will show how through successive transformations we may obtain an untyped normalization by evaluation algorithm, in fact precisely the algorithm presented in (Boespflug, 2009). This algorithm is but one of several variants of untyped normalization by evaluation algorithms, and indeed the transformations presented here can readily be adapted to derive the algorithms of Aehlig et al. (2008) and Filinski and Rohde (2004). Because the starting points of these transformations are in fact standard definitions of evaluators and normalizers, it is possible to obtain the correctness of the normalization by evaluation algorithm as a corollary of the correctness of the meaning preserving transformations we use.
منابع مشابه
Building Interpreters with Rewriting Strategies
Programming language semantics based on pure rewrite rules suffers from the gap between the rewriting strategy implemented in rewriting engines and the intended evaluation strategy. This paper shows how programmable rewriting strategies can be used to implement interpreters for programming languages based on rewrite rules. The advantage of this approach is that reduction rules are first class e...
متن کاملA Comparative Study of Meta-Tracing and Partial Evaluation as Foundation for Self-Optimizing Interpreters
Tracing and partial evaluation have been proposed as metacompilation techniques for interpreters to make just-in-time compilation language-independent. They promise that programs executing on simple interpreters can reach performance of the same order of magnitude as if they would be executed on state-of-the-art virtual machines with highly optimizing just-in-time compilers built for a specific...
متن کاملA Self - Applicable Partial Evaluator for the Logic Programming Language
Partial evaluation is a program specialisation technique that has been shown to have great potential in logic programming, particularly for the specialisation of meta-interpreters by the so-called " Futamura Projections ". Meta-interpreters and other meta-programs are programs which use another program as data. The Futamura projections also show that partial evaluator which is self-applicable (...
متن کاملNormalization and Reliability Evaluation of Persian Version of Two-Pair Dichotic Digits in 8 to 12-Year-Old Children
Objectives: All subjects suspected of Central Auditory Processing Disorder (CAPD) were previously tested by free recall dichotic digits test (DDT). The study objective was normalization and reliability evaluation of two-pair DDT in 750 native Persian subjects aged 8 to 12 years. Materials: A total of 750 subjects were divided into five age groups varying between 8 years and 12 years and 11 mon...
متن کاملProfessional considerations for improving the neuropsychological evaluation of Hispanics: a National Academy of Neuropsychology education paper.
In a national survey, 82% of U.S. neuropsychologists who offered services to Hispanics self-reported inadequate preparation to work with this population (Echemendia, Harris, Congett, Diaz, & Puente, 1997). The purpose of this paper is to improve the quality and accessibility of neuropsychological services for Hispanic people living in the United States by giving guidance for service delivery, t...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- CoRR
دوره abs/0911.4203 شماره
صفحات -
تاریخ انتشار 2009